home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_1599 / 1203 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  2.5 KB

  1. Subject: control ttys again
  2. Date: Tue, 15 Mar 94 7:28:56 CET
  3. From: Juergen Lock <nox@jelal.north.de>
  4. Message-Id: <9403150629.AA00350@jelal.north.de>
  5.  
  6. hello
  7.  
  8.  yes dosmem.c again...  and set_auxhandle (Bconmap) did not ++tty->use_cnt
  9. wich was another reason for zeroed tty pgroups.
  10.  
  11.  now if the modem devices could turn off local mode and send signals
  12. immediately... :)
  13.  
  14.  cheers
  15.     Juergen
  16.  
  17. Index: dosmem.c
  18. @@ -748,6 +748,7 @@
  19.          }
  20.      }
  21.  
  22. +#if 0
  23.  /* release the controlling terminal, if we're a process group leader */
  24.      fp = curproc->handle[-1];
  25.      if (fp && is_terminal(fp) && curproc->pgrp == curproc->pid) {
  26. @@ -755,6 +756,37 @@
  27.          if (curproc->pgrp == tty->pgrp)
  28.              tty->pgrp = 0;
  29.      }
  30. +#else
  31. +/* release the controlling terminal, if we're the last member of this pgroup */
  32. +    fp = curproc->control;
  33. +    if (fp && is_terminal(fp)) {
  34. +        struct tty *tty = (struct tty *)fp->devinfo;
  35. +        int pgrp = curproc->pgrp;
  36. +
  37. +        if (pgrp == tty->pgrp) {
  38. +            PROC *p;
  39. +            FILEPTR *pfp;
  40. +
  41. +            if (tty->use_cnt > 1) {
  42. +                for (p = proclist; p; p = p->gl_next) {
  43. +                    if (p->pgrp == pgrp && p != curproc &&
  44. +                        ((pfp = p->control)) &&
  45. +                        pfp->fc.index == fp->fc.index &&
  46. +                        pfp->fc.dev == fp->fc.dev)
  47. +                        goto found;
  48. +                }
  49. +            } else {
  50. +                for (p = proclist; p; p = p->gl_next) {
  51. +                    if (p->pgrp == pgrp && p != curproc &&
  52. +                        p->control == fp)
  53. +                        goto found;
  54. +                }
  55. +            }
  56. +            tty->pgrp = 0;
  57. +        }
  58. +found:
  59. +    }
  60. +#endif
  61.  
  62.  /* close all files */
  63.      for (i = MIN_HANDLE; i < MAX_OPEN; i++) {
  64. Index: biosfs.c
  65. @@ -1885,6 +1885,7 @@
  66.  
  67.      f = new_fileptr();
  68.      if (f) {
  69. +        struct tty *tty;
  70.          f->links = 1;
  71.          f->flags = O_RDWR;
  72.          f->pos = 0;
  73. @@ -1900,6 +1901,16 @@
  74.                  f->dev = b->device;
  75.                  if (b->device != &fakedev)
  76.                      f->devinfo = (long)b->tty;
  77. +#if 1
  78. +/* don't close and reopen the same device again
  79. + */
  80. +                if (p->aux && p->aux->fc.fs == &bios_filesys &&
  81. +                    p->aux->fc.index == f->fc.index) {
  82. +                    f->links = 0;
  83. +                    dispose_fileptr(f);
  84. +                    return 1;
  85. +                }
  86. +#endif
  87.                  goto found_device;
  88.              }
  89.          }
  90. @@ -1911,6 +1922,16 @@
  91.              dispose_fileptr(f);
  92.              return 0;
  93.          }
  94. +/* special code for opening a tty */
  95. +        if ((tty = (struct tty *)f->devinfo)) {
  96. +            extern struct tty default_tty;    /* in tty.c */
  97. +
  98. +            /* first open for this device? */
  99. +            if (tty->use_cnt == 0) {
  100. +                *tty = default_tty;
  101. +            }
  102. +            tty->use_cnt++;
  103. +        }
  104.      } else {
  105.  /* no memory! use the fake FILEPTR we
  106.   * set up in biosfs_init
  107. -- 
  108. J"urgen Lock / nox@jelal.north.de / UUCP: ..!uunet!unido!uniol!jelal!nox
  109.                                 ...ohne Gewehr
  110. PGP public key fingerprint =  8A 18 58 54 03 7B FC 12  1F 8B 63 C7 19 27 CF DA 
  111.